From 8c48c9e2ad06aa8d2d5faee7fe5c52a4a82a3df5 Mon Sep 17 00:00:00 2001 From: "emellor@leeni.uk.xensource.com" Date: Fri, 28 Oct 2005 13:02:06 +0100 Subject: [PATCH] Fix reboot logic. An indentation error meant that every second reboot would be refused, with the domain being destroyed instead. Further fix for reboot logic when using on_reboot=rename-restart: the incorrect node was being removed once restart has completed, leaving Xend to conclude later that it had crashed in the middle of a restart. Signed-off-by: Ewan Mellor --- tools/python/xen/xend/XendDomainInfo.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index 999716219d..7e2199ec6e 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -1275,7 +1275,6 @@ class XendDomainInfo: now = time.time() rst = self.readVm('xend/previous_restart_time') - log.error(rst) if rst: rst = float(rst) timeout = now - rst @@ -1284,8 +1283,8 @@ class XendDomainInfo: 'VM %s restarting too fast (%f seconds since the last ' 'restart). Refusing to restart to avoid loops.', self.info['name'], timeout) - self.destroy() - return + self.destroy() + return self.writeVm('xend/previous_restart_time', str(now)) @@ -1306,7 +1305,11 @@ class XendDomainInfo: except: log.exception('Failed to restart domain %d.', self.domid) finally: - self.removeVm('xend/restart_in_progress') + # new_dom's VM will be the same as this domain's VM, except where + # the rename flag has instructed us to call preserveForRestart. + # In that case, it is important that we use new_dom.removeVm, not + # self.removeVm. + new_dom.removeVm('xend/restart_in_progress') # self.configure_bootloader() # self.exportToDB() -- 2.30.2